﻿using Confluent.Kafka;
using ProtoBuf;
using System.IO;

namespace Zhaoxi.Protobuf
{
	internal class CustomStringSerializer<T> : ISerializer<T>
	{
		public byte[] Serialize(T data, Confluent.Kafka.SerializationContext context)
		{
			//这是通过protbuf压缩
			byte[] datas;
			using (var stream = new MemoryStream())
			{
				Serializer.Serialize(stream, data);
				datas = stream.ToArray();
			}
			return datas;


		}
	}
}